#include <stdio.h>
#include <sys/mman.h>
#include <string.h>

int main()
{
  printf("pid = %d\n",getpid());
  void *p = mmap(0,4, PROT_READ|PROT_WRITE, MAP_ANONYMOUS|MAP_PRIVATE,0,0);
  printf("p = %p\n",p);
  if(p == MAP_FAILED)
  {
      perror("mmap"); exit(-1);
  }
  int *p1 = p ;
  *p1 = 100 ;
  char *str = p + 4;
  strcpy(str,"abcdefg");

  char *pa = p;  

  for(int i = 0 ; i < 11 ; ++i)
  {
    printf("%d ",pa[i]);
  }
  munmap(p,4);
  printf("\n");
  return 0; 
}
